﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RiaToDalLinq.Enumeration;

namespace RiaToDalLinq.Contracts
{
    /// <summary>
    /// Provides all relevant methods for resolving DAL instance information for the query provider
    /// </summary>
    public interface IDalResolver
    {
        /// <summary>
        /// Given an entity name, the method must return a valid manager for that entity
        /// (e.x. If the entity name is User, this should return a UserManager which exposes all the CRUD methods required)
        /// </summary>
        /// <param name="entityName"></param>
        /// <returns></returns>
        object GetManagerInstance(string entityName);

        /// <summary>
        /// Given the type we are looking up, the name of the id field, the name of the code field, and the code value, returns the corresponding id
        /// For example, if the lookup type is a User, the id field is UserId, the code field is UserName, and the code value is jim.jones, this method
        /// should return a userid for jim.jones.
        /// </summary>
        /// <param name="lookupEntityType"></param>
        /// <param name="idField"></param>
        /// <param name="codeField"></param>
        /// <param name="codeValue"></param>
        /// <returns></returns>
        int? GetIdFromCode(Type lookupEntityType, string idFieldName, string codeFieldName, string codeValue);

        /// <summary>
        /// 
        /// </summary>
        Tuple<string, string> WhereClauseParameter { get; }

        /// <summary>
        /// 
        /// </summary>
        Tuple<string, string> OrderByParameter { get; }

        /// <summary>
        /// 
        /// </summary>
        Tuple<string, int> PageStartParameter { get; }

        /// <summary>
        /// 
        /// </summary>
        Tuple<string, int> PageSizeParameter { get; }

        /// <summary>
        /// 
        /// </summary>
        Tuple<string, int> RowCountParameter { get; }

        /// <summary>
        /// 
        /// </summary>
        PageStartActAs PageStartActingAs { get; }

    }
}
